var itemHeight = 40;

function openMenu(obj) {
    menu = document.getElementById('menu1');
    indicator = document.getElementById('indicator1');
    height = menu.style.height;

    if (height == "0px" || height == "") {
        childAmount = menu.getElementsByTagName('div').length;
        height = childAmount * itemHeight;
        menu.style.height = height + "px";
        indicator.style.transform = "rotate(-90deg)";
    } else {
        menu.style.height = "0px";
        indicator.style.transform = "rotate(0deg)";
    }
}

window.onload=function () {
        var as=document.getElementsByClassName('content-header')[0].getElementsByTagName('a');
        var contents=document.getElementsByClassName("dom");
        for (var i=0;i<as.length;i++){
            var a=as[i];
            a.id=i;
            // 设置每个a标签的onclick事件
            a.onclick=function () {
                // 清楚所有标签的css设置，隐藏dom标签
                for(var j=0;j<as.length;j++){
                    as[j].className="";
                    contents[j].style.display="none";
                }
                // 设置当前标签样式及当前标签下的所有dom标签可见
                this.className='current';
                // 当前div可见
                contents[this.id].style.display='block';
            }
        }
    }